#pragma once


#include <vector>
using namespace std;

#include "gameObject.h"
#include "explosionParticle.h"
#include "ofMain.h"
#include "ofxVectorMath.h"
#include "src/testApp.h"
#include "settings.h"

class explosionParticle;

typedef  struct
{
        blob* start;
        blob* end;
        float value;
        bool broken;
        bool fadedOut;
        int fadeStart;
        float fadeAlphaMod;
        vector<explosionParticle*> betweenBlobParticles;
} explosionBetweenBlobs;

class blob :
	public gameObject
{
public:
	blob(int type, ofxVec2f pos, float mass, ofxVec2f velocity);
	~blob(void);
    ofImage image;
    void drawImageAsCirlce(ofImage img, float x, float y, float radius, int count);
	int type;
	float growSpeed;
	float mass;
	ofxVec2f velocity;
	float maxMass;
	float targetMass;
	float initialMass;
	bool dead;
    bool fadedOut;
    int targeted;
    int fadeStart;
	int numFriends;
	float maxVelocity;
	float maxMaxVelocity;
	float friction;
	bool exploding;
	bool readyToExplode;
	bool justExploded;
	float nextPixelBeat;
	float timeToDie;
	float timeToExplode;
	bool canExplode;
	void drawBehind();
	void draw();
	int update();

    bool shouldRemove();

    float getFadedOutPercentage();

	float getRadius();
	float getInitialRadius();
	float getCoreRadius();
	float setRadius(float radius);

	float getExplosionRadius();
    void drawLineTo(ofxVec2f pos);
	float growMass(float growth);
	void attract(ofxVec2f pos, float mass);
	void interact(ofxVec2f pos);
	void onContact(blob * colPartner);
    void testIfFriend(vector<blob*> friendBlob);
	void drawFriend(blob *friendBlob);

	float getStringLength();

	float getStringPercent(ofxVec2f diff);

	vector<explosionParticle*> explode();
	vector<explosionBetweenBlobs> explosionData;

	float seed2;
	float seed1;

protected:


};

